﻿using Dpx.Services;
using GalaSoft.MvvmLight.Ioc;
using Xamarin.Forms;

namespace Dpx.ViewModels {
    public class ViewModelLocator {
        public ResultPageViewModel ResultPageViewModel => SimpleIoc.Default.GetInstance<ResultPageViewModel>();
        public TodayPageViewModel TodayPageViewModel => SimpleIoc.Default.GetInstance<TodayPageViewModel>();
        public DetailPageViewModel DetailPageViewModel => SimpleIoc.Default.GetInstance<DetailPageViewModel>();
        public QueryPageViewModel QueryPageViewModel => SimpleIoc.Default.GetInstance<QueryPageViewModel>();
        /// <summary>
        /// 数据同步页ViewModel。
        /// </summary>
        public SyncPageViewModel SyncPageViewModel =>
            SimpleIoc.Default.GetInstance<SyncPageViewModel>();

        /// <summary>
        /// 菜单页ViewModel。
        /// </summary>
        public MenuPageViewModel MenuPageViewModel =>
            SimpleIoc.Default.GetInstance<MenuPageViewModel>();

        /// <summary>
        /// 初始化页ViewModel。
        /// </summary>
        public InitializationPageViewModel InitializationPageViewModel =>
            SimpleIoc.Default.GetInstance<InitializationPageViewModel>();

        /// <summary>
        /// 主页ViewModel。
        /// </summary>
        public MainPageViewModel MainPageViewModel =>
            SimpleIoc.Default.GetInstance<MainPageViewModel>();


        /// <summary>
        /// 诗词收藏页ViewModel。
        /// </summary>
        public FavoritePageViewModel FavoritePageViewModel =>
            SimpleIoc.Default.GetInstance<FavoritePageViewModel>();




        public ViewModelLocator() {
            SimpleIoc.Default.Register<ISyncService, SyncService>();
            SimpleIoc.Default.Register<IFavoriteStorage, FavoriteStorage>();
            SimpleIoc.Default.Register<IRootPageActivationService, RootPageActivationService>();
            SimpleIoc.Default.Register<IRootNavigationService, RootNavigationService>();
            SimpleIoc.Default.Register<IContentNavigationService, ContentNavigationService>();
            SimpleIoc.Default.Register<IContentPageActivationService, ContentPageActivationService>();
            SimpleIoc.Default.Register<ITodayImageService, BingImageService>();
            SimpleIoc.Default.Register<ITodayPoetryService, JinrishiciService>();
            SimpleIoc.Default.Register<IAlertService, AlertService>();
            SimpleIoc.Default.Register<IPreferenceStorage, PreferenceStorage>();
            SimpleIoc.Default.Register<IPoetryStorage, PoetryStorage>();
            SimpleIoc.Default.Register<IBrowserService, BrowserService>();
            SimpleIoc.Default.Register<ResultPageViewModel>();
            SimpleIoc.Default.Register<TodayPageViewModel>();
            SimpleIoc.Default.Register<DetailPageViewModel>();
            SimpleIoc.Default.Register<ITodayImageStorage, TodayImageStorage>();
            SimpleIoc.Default.Register<QueryPageViewModel>();
            SimpleIoc.Default.Register<MenuPageViewModel>();
            SimpleIoc.Default.Register<InitializationPageViewModel>();
            SimpleIoc.Default.Register<MainPageViewModel>();
            SimpleIoc.Default.Register<FavoritePageViewModel>();
            SimpleIoc.Default.Register<OneDriveFavoriteStorage>();
            SimpleIoc.Default.Register<SyncPageViewModel>();
        }
    }
}